home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Communications / General / LineShare Folder / Put Onto Productions Disks / LineShare Scripts / Pro⁄Office VoiceFaxTelefinder < prev    next >
Text File  |  1994-01-27  |  6KB  |  274 lines

  1. ! Version 2.2
  2. !
  3. !$ Use with: Prometheus (non-Ultima) Home Office modems.
  4. !
  5. !$ Supports: MaxFax voice/fax and TeleFinder
  6. !
  7. !$ In MaxFax, set "Rings till answer" to 1, "Toll Saver" to 0.
  8. !
  9. !$ To access the TeleFinder host, extend the phone number with
  10. !$ 8 commas and 1-3 "Data Link Codes" separated with commas.
  11. !
  12. !$ Sample: "555-234,,,,,,,,5,5,5".
  13.  
  14. ^2 Speaker On:        = Enum("Never" = "0","During Connect" = "1", "Always"="2") "1"
  15. ^3 Speaker Volume:       = Enum("Low"="1","Medium"="2","High"="3") "2"
  16. ^4 Answer On:         = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
  17. ^5 Fax Identifier:    = Text "Stalker"
  18. ^6 Handshake wires:   = Bool("CTS/RTS"="&D0\Q3","CTS only"="&D2\Q2") "&D2\Q2"
  19. ^7 Data Line Code:    = Enum("1"="","2"="","3"="","4"="","5"="","6"="","7"="","8"="","9"="") ""
  20. ! ------------------------------------------
  21. ! Resetting the modem:
  22. ! ------------------------------------------
  23. @Hangup
  24.   Note "Resetting" 3
  25.   SetTries 2
  26.   Flush
  27.   HsReset 0,0,17,19,0,0
  28. !
  29. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  30. ! to enter the command mode
  31. !
  32. @Label 1
  33.   matchclr
  34.   matchstr 1 2 "OK\r\n"
  35.   write "ATH0&F\r"
  36.   matchread 20
  37.   Write "+++"
  38.   DtrClear
  39.   pause 5
  40.   DtrSet
  41. !
  42.   SerReset 19200,0,8,1
  43.   DecTries
  44.   IfTries 1 1
  45.   SerReset 9600,0,8,1
  46.   IfTries 0 1
  47. !
  48. ! OSErr -6019 "Modem error - the modem is not responding"
  49. !
  50.   exit -6019
  51. @Label 2
  52.   SerReset 9600,0,8,1
  53.   write "AT+FCLASS=0\r"
  54.   Jsr 100
  55.   write "AT+FAA=0\r"
  56.   Jsr 100
  57.   Flush
  58.   Write "ATI9\r"
  59.   MatchClr
  60.   MatchStr 1 3 "\r\n^$\r\n\r\nOK\r\n" 
  61.   MatchStr 2 4 "ERROR\r\n"
  62.   MatchRead 5
  63.   Jump 4
  64. @Label 3
  65.   SetInfo 9 "^$"
  66. @Label 4
  67.   exit 0
  68.  
  69. ! ------------------------------------------
  70. !    Receiving incoming calls
  71. ! ------------------------------------------
  72. @ANSWER
  73. !
  74. ! Set the modem preferred speed first
  75. !
  76.   SerReset 9600,0,8,1
  77.   Jsr 80
  78. @Label 10
  79. !
  80. ! Set the common options
  81.   Jsr 70
  82.  
  83.   Write "AT+FAA=1\r"
  84.   Jsr 100
  85. !
  86. ! Everything is ready - let's sit and wait for a call
  87. ! We'll wait for 5 minutes, then reinitiate the modem
  88. !
  89.   Note "Waiting for a fax/voice or TeleFinder call…"
  90.   SetTries Val("^4")
  91. @Label 15
  92.   MatchClr
  93.   matchstr 1 16 "RING\r\n"
  94.   Matchread 3000
  95.   jump 10
  96. @Label 16
  97.   Note "Ring…"
  98.   DecTries
  99.   IfTries 1 15 
  100.  
  101. ! A = <dle> 0x11 <digit code>
  102. ! B = 0x1F (* code)
  103. !
  104.   SetVar A "\16\17^7"
  105.   SetVar B "\31\r\nOK\r\n"
  106.   QueueInput "\r\nRING\r\n\r\nRING\r\n"
  107.   Attach "MaxFax" (DTR,Escape,Master,Check(A,B))
  108.   Pause 5
  109. !
  110. !now abort greetings, if any in progress
  111.   Write "\16\03"
  112.   MatchClr
  113.   MatchStr 1 17 "OK\r\n"
  114.   MatchRead 40
  115. @Label 17
  116. !
  117. ! switch off voice modes
  118.   Write "AT#VS0\r"
  119.   Jsr 100
  120.   SerReset 9600,0,8,1
  121.  
  122.   Write "AT+FAA=0\r"
  123.   Jsr 100
  124. !
  125. ! Set the common options
  126.   Jsr 70
  127. !
  128. ! Set TeleFinder parameters, force to answer in the data mode
  129.   Write "AT\\N3%C1S48=7 A\r"
  130.   MatchClr
  131.   MatchStr 1 20 "\r\nCONNECT ^$\r\n"
  132.   MatchStr 4 93 "NO CARRIER\r\n"
  133.   MatchStr 5 94 "NO ANSWER\r\n"
  134.   MatchRead 300
  135.   Write "\r"
  136.   Exit -6019
  137.  
  138.  
  139. @Label 20
  140.   QueueInput "\r\27CONNECT ^$\r\27"
  141.   QueueInput "\r\27RING\r\27"
  142.   Attach "TF" (DTR,Escape,Break,Reset,IdleLimit=60)
  143.  
  144. ! ------------------------------------------
  145. ! Originating a call through the "TF" subport
  146. ! ------------------------------------------
  147. @ORIGINATE "TF"
  148.   SerReset 9600,0,8,1
  149.   Jsr 80
  150. !
  151. ! Set the common options
  152. !
  153.   Jsr 70
  154. !
  155.   Jsr 60
  156. !
  157. ! Prepare to receive all error result codes, dial the number
  158. !
  159.   Jsr 90
  160.   MatchStr 1 25 "\r\nCONNECT"
  161.   MatchRead 1000
  162.   Write "\r"
  163.   Exit -6019
  164.  
  165. @Label 25
  166.   QueueInput "\r\nCONNECT"
  167.   Attach "TF" (DTR,Escape,Break,Reset)
  168.  
  169. ! ------------------------------------------
  170. ! Originating a call through the "MaxFax" subPort
  171. ! ------------------------------------------
  172. @ORIGINATE "MaxFax" ("\r\nLineShare Line is Busy\r\nBUSY\r\n")
  173. !
  174. ! Set the "Fax" speed
  175. !
  176.   SerReset 9600,0,8,1
  177.   Jsr 80
  178. !
  179. ! Set the common options
  180. !
  181.   Jsr 70
  182. !
  183. ! Set the Fax mode
  184. !
  185.   Write "AT+FCLASS=2\r"
  186.   Jsr 100
  187.   SetSpeed 19200
  188. !
  189. ! Now emit all commands that the application has sent to that port, except +FCLASS
  190. !
  191.   EmitClear "+FCLASS"
  192.   Jsr 60
  193. !
  194. ! Prepare to receive all error result codes, dial the number
  195. !
  196.   Jsr 90
  197.   HSReset 0 1 0 0 0 0
  198.   MatchStr 1 30 "\r\n+FCON"
  199.   MatchRead 900
  200.   Write "\r"
  201.   Exit -6019
  202. @Label 30
  203.   QueueInput "\r\n+FCON"
  204.   Attach "MaxFax" (DTR,Escape)
  205.  
  206. !
  207. ! This section emits all modem commands sent from the client application
  208. ! For each set of commands the "OK" answer is awaited
  209. !
  210. @Label 60
  211.   EmitStart
  212. @Label 61
  213.   EmitCommand 62
  214.   Jsr 100
  215.   Jump 61
  216. @Label 62
  217.   return
  218. !
  219. ! This section initiates the modem before ANSWER and ORIGINATEs:
  220. ! extended responses + connect at the highest rate + speaker control +
  221. ! reset on Dtr drop 
  222. ! Verbal responses mode, no echo 
  223. !
  224. @Label 70
  225.   Write "ATX4M^2L^3^6V1E0\r"
  226.   Jsr 100
  227.   return 
  228.  
  229. !
  230. ! This section syncronize the modem after the serial port speed switching
  231. !
  232. @Label 80
  233.   ChrDelay 1
  234.   Write "AT\r"
  235.   ChrDelay 0
  236.   Jsr 100
  237.   return
  238. !
  239. ! Prepare to receive error result codes, send the dialing command and
  240. ! set the user's handshake mode
  241. !
  242. @Label 90
  243.   MatchClr
  244.   MatchStr 2 91 "NO DIALTONE\r\n"
  245.   MatchStr 3 92 "BUSY\r\n"
  246.   MatchStr 4 93 "NO CARRIER\r\n"
  247.   MatchStr 5 94 "NO ANSWER\r\n"
  248.   Write "ATD^1\r"
  249.   HsReset *
  250.   return
  251. @Label 91
  252.   exit -6020
  253. @Label 92
  254.   exit -6022
  255. @Label 93
  256.   exit -6021
  257. @Label 94
  258.   exit -6023
  259. !
  260. ! Processing the AT command:
  261. ! OK -> proceed
  262. ! ERROR or TimeOut ->exit -6019
  263. ! It can be called AFTER the "Write" command, since LineShare buffers input
  264. !
  265. @Label 100
  266.   MatchClr
  267.   MatchStr 1 102 "\r\nOK\r\n"
  268.   MatchStr 2 101 "\r\nERROR\r\n"
  269.   MatchRead 20
  270. @Label 101
  271.   Exit -6019
  272. @Label 102
  273.   return
  274.